$(function() {
	var id = getQueryString("id");
	ajaxselectFriendByFid(id);
});

/**
 * 加载单个朋友的详细信息
 * @param friendId	好友的用户id
 */
function ajaxselectFriendByFid(friendId){
    var url="/Lvscore_User_M/account/ajaxselectFriendByFid";
    $.post(
    	url,
    	{'friendId' : friendId},
    	function(data){
    		/*friend：FriendBean*/
    		$("#img_").html('<img width="150px" height="150px" src="' + getImageUrl(data.image_url) + '" alt="">');
    		$("#username_").text(data.name);
    		$("#f_name").text(data.name);
    		$("#donkey_num_").text(data.devId);
    		$("#area_").text(data.area);
    		$("#tel_").text(data.tel_num);
    		$("#sign_").text(data.sign);
    	},
    	"json"
    );
}
function getImageUrl(url) {
	if (url == '' || url == null) {
		return "/Lvscore_User_M/userWeb/static/images/manageWrap_pic.png";
	} else {
		return url;
	}
}
/**
 * 删除好友
 */
function ajaxdeletefriend(){
	confirmClose();
	var url="/Lvscore_User_M/account/ajaxdeletefriend";
	$.post(
		url,
		{'deleteId' : $("#donkey_num_").text()},
		function(data){
			if (data == 1)
				history.go(-1);
			else if (data == -1) 
				alertBox("删除失败","");
			else
				alertBox("服务器异常","")
		},
		"json"
	);
}

function transferTofriend() {
	window.location.href = "/Lvscore_User_M/userWeb/views/ADadmin/payment/friendLink.html?i=" + $("#donkey_num_").text();
}


/**
 * 确认框弹出和关闭
 */
function confirmBox(){
	$(".mask").show();
	$(".confirmBox").show();
}
